﻿
namespace TemplateFoundation.UI.WebControls
{
    /// <summary>
    /// Used to add an image selector control when creating user interfaces for the EPiServer UI
    /// </summary>
    public class ImageSelector : PagePropertyStyleControlBase
    {
        private readonly SimplePropertyImageUrlControl _control = new SimplePropertyImageUrlControl();

        /// <summary>
        /// Creates a new ImageSelector and sets default Name and Description values
        /// </summary>
        public ImageSelector()
        {
            Name = "Image";
            Description = "Select an image on the website";
        }

        /// <summary>
        /// Creates the property control to render
        /// </summary>
        public override System.Web.UI.Control CreatePropertyControl()
        {
            return _control;
        }

        /// <summary>
        /// Gets or sets the URL of the selected image
        /// </summary>
        public string SelectedImageUrl
        {
            get
            {
                return _control.SelectedImageUrl;
            }
            set
            {
                _control.SelectedImageUrl = value;
            }
        }

        /// <summary>
        /// Gets the client ID of the value control
        /// </summary>
        public string ValueControlId
        {
            get
            {
                return _control.ValueControlId;
            }
        }
    }
}
